﻿using M2B.GestionEntretiens.BLL;
using M2B.GestionEntretiens.Contracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using M2B.GestionEntretiens.DAL;
using M2B.GestionEntretiens.POCOS;

namespace M2B.GestionEntretiens.Services
{
    /// <summary>
    /// Cette classe implémente le contrat Questions Service
    /// </summary>
    /// <remarks>
    /// Informations de la classe : 
    /// <list type="bullet">
    /// <item name="authors">Auteur : M2B : Maher SAMMARI</item>
    /// <item name="creation date">Date de création : 02/04/2014</item>
    /// <item name="last modification">Date de dernière modification : 02/04/2014</item>
    /// </list>
    /// </remarks>
    public class QuestionsService : IQuestionsService
    {
        private readonly IUnitOfWork _unitOfWorky;
        private QuestionsManager _questionsManager;

        public QuestionsService(IUnitOfWork unitOfWork)
        {
            _unitOfWorky = unitOfWork;
            _questionsManager = new QuestionsManager(_unitOfWorky);

        }
        #region Méthodes
        /// <summary>
        /// Récupération de la liste des questions
        /// </summary>
        /// <returns>Questions</returns>
        public IEnumerable<Question> GetQuestions()
        {
            return _questionsManager.GetQuestions("Propositions");
        }
        /// <summary>
        /// Mise à jour d'une question
        /// </summary>
        /// <param name="question">Question</param>
        public void Update(Question question)
        {
            _questionsManager.UpdateQuestion(question);
        }
        /// <summary>
        /// Supprimer une question 
        /// </summary>
        /// <param name="questionId">Id</param>
        public void DeleteQuestion(int questionId)
        {
            _questionsManager.DeleteQuestion(questionId);
        }
        /// <summary>
        /// Ajouter uen question
        /// </summary>
        /// <param name="question">Question</param>
        public void AddQuestion(Question question)
        {
           _questionsManager.CreateQuestion(question);
        }
        #endregion


       
    }
}
